#ifndef LONGKEY_PCAGENT_PROCESS_LAUNCHER_H_
#define LONGKEY_PCAGENT_PROCESS_LAUNCHER_H_

#include "pcagent_idl.h"

const TCHAR* const kTlbVersion = _T("1.0");
const TCHAR* const kProcessWorkerDescription =
	_T("Longkey PCAgent Process Launcher Class");

class ATL_NO_VTABLE ProcessLauncher
	: public CComboBoxEx<CComMultiThreadModel>,
	  public CComCoClass<ProcessLauncher, &__uuidof(ProcessLauncherClass)>,
	  public IProcessLauncher,
	  public StdMarshalInfo
{
public:
	ProcessLauncher();
	virtual ~ProcessLauncher();

	DECLARE_NOT_AGGREGATABLE(ProcessLauncher)
	DECLARE_PROTECT_FINAL_CONSTRUCT()

	DECLARE_REGISTRY_RESOURCEID_EX(IDR_LOCAL_SERVER_RGS)

#pragma warning(push)
// C4640: construction of local static object is not thread-safe
#pragma warning(disable: 4640)
BEGIN_REGISTRY_MAP()
	REGMAP_ENTRY(_T("HKROOT"),		pcagent_utils::GetHKRoot())
	REGMAP_MODULE2(_T("MODULE"),	kPCAgentOnDemandFileName)
	REGMAP_ENTRY(_T("VERSION"),		kTlbVersion)
	REGMAP_ENTRY(_T("PROGID"),		kProgIDProcessLauncher)
	REGMAP_ENTRY(_T("DESCRIPTION"),	kProcessWorkerDescription)
	REGMAP_ENTRY(_T("CLSID"),		__uuidof(ProcessLauncherClass))
END_REGISTRY_MAP()
#pragma warning(pop)

#pragma warning(disable: 4505)
BEGIN_COM_MAP(ProcessLauncher)
	COM_INTERFACE_ENTRY(IProcessLauncher)
	COM_INTERFACE_ENTRY(IStdMarshalInfo)
END_COM_MAP()

	// Launches a command line at medium integrity.
	STDMETHOD(LaunchCmdLine)(const TCHAR* cmd_line);

	// Launches the appropriate browser.
	STDMETHOD(LaunchBrowser)(DWORD type, const TCHAR* url);

private:
	DISALLOW_EVIL_CONSTRUCTORS(ProcessLauncher);
};

#endif	// LONGKEY_PCAGENT_PROCESS_LAUNCHER_H_